<?php

namespace App\Http\Controllers\Wx;

use App\Http\Controllers\Controller;
use EasyWeChat\Factory;
//use EasyWeChat\OfficialAccount\Application;
use Illuminate\Http\Request;
class WxCommonController extends Controller
{
    protected $wx,$wechatApp;
    ////        $this->wx = Factory::officialAccount($config); // 小程序
    //        //\EasyWeChat::officialAccount(); // 公众号
    public function __construct()
    {
        $config = [
            'app_id' => config('wechat.official_account.default.app_id'),
            'secret' => config('wechat.official_account.default.secret'),
            'token' => config('wechat.official_account.default.token'),
            'aes_key' => config('wechat.official_account.default.aes_key'),
            'oauth' => [
                'scopes'   => ['snsapi_userinfo'],
                'callback' => '/oauth_callback',
            ],
        ];
        $this->wechatApp =  Factory::officialAccount($config);

    }
}
